//
//  UIBasicsViewController.swift
//  SwiftDemo
//
//  Created by hfzhangzhang on 2018/7/11.
//  Copyright © 2018年 hfzhangzhang. All rights reserved.
//

import UIKit

class UIBasicsViewController: UIViewController {
    
    let viewDemo:UIView = {
        let viewDemo = UIView(frame: CGRect(x: 10, y: 10, width: 100, height: 50));
        viewDemo.backgroundColor = UIColor.blue;
        return viewDemo;
    }()
    
    let lableDemo:UILabel = {
        let lableDemo = UILabel(frame: CGRect(x: 10, y: 70, width: 300, height: 50))
        //富文本设置
        let attributeString = NSMutableAttributedString.init(string: "welcome to Swift 我是车神")
        //从文本0开始6个字符字体HelveticaNeue-Bold,16号
        attributeString.addAttribute(kCTFontAttributeName as NSAttributedStringKey, value: UIFont.init(name: "HelveticaNeue-Bold", size: 23) ?? UIFont.boldSystemFont(ofSize: 23), range: NSRange.init(location: 0, length: 6))
        lableDemo.attributedText = attributeString
        return lableDemo;
    }()
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.yellow;
        self.view.addSubview(self.viewDemo);
        self.view.addSubview(self.lableDemo);
    }

}

